home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / advsys.arc / ADVSYS.DOC < prev    next >
Text File  |  1986-01-12  |  29KB  |  1,123 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                       ADVSYS - An Adventure Writing System
  8.                                  by David Betz
  9.                                 January 11, 1986
  10.  
  11.                        Copyright (c) 1986, by David Betz
  12.                               All Rights Reserved
  13.         Permission is hereby granted for unrestricted non-commercial use
  14.  
  15.  
  16.  
  17.         INTRODUCTION
  18.  
  19.         ADVSYS is a special purpose programming language that was
  20.         specifically designed to be used to write computer text
  21.         adventure games.  It includes a facility for defining the kinds
  22.         of objects that are common in adventures.  Some objects
  23.         represent locations on the game map, some objects represent
  24.         things that the player can find while exploring the adventure
  25.         world, and some objects represent other characters that the
  26.         adventurer can encounter during his or her journeys.  The
  27.         adventure language also provides a facility to define actions.
  28.         Actions are short sections of code that determine what happens
  29.         in response to a command from the player.  These two concepts,
  30.         "objects" and "actions" form the basis for the adventure
  31.         language.
  32.  
  33.  
  34.         ACKNOWLEDGEMENTS
  35.  
  36.         Although I have written all of the code associated with this
  37.         adventure writing system, I must acknowledge the assistance of
  38.         one individual without whom this project would probably never
  39.         have reached completion.  That person is Gary McGath.  Gary was
  40.         interested in writing a commercial quality adventure game and I
  41.         convinced him to write it using my system (which was as yet
  42.         almost completely unspecified) instead of using a traditional
  43.         programming language.  The input that Gary provided during the
  44.         development of his game contributed significantly to the overall
  45.         design of the system.  I would like to thank Gary for that
  46.         contribution.
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         ADVSYS            An Adventure Writing System             Page 2
  71.  
  72.  
  73.         USING THE SYSTEM TO WRITE AN ADVENTURE
  74.  
  75.         In order to write an adventure using this system, you need to
  76.         write an adventure description.  This is an ordinary ASCII text
  77.         file containing definitions for all of the objects and actions
  78.         in your adventure game.  This file is used as input to the
  79.         adventure compiler.  The compiler takes the adventure
  80.         description and compiles it into a set of data structures.
  81.  
  82.         In order to play an adventure written using this system, you
  83.         need the data structure file that was produced by the compiler
  84.         and the adventure interpreter program.  The interpreter uses the
  85.         information produced by the adventure compiler to allow a player
  86.         to play the adventure game.  Notice that it is not necessary for
  87.         the player to have access to the original adventure description
  88.         file.  All of the information that is necessary to play the
  89.         adventure game is contained within the data structure file that
  90.         is produced by the compiler.  This file is a binary file that
  91.         cannot be simply "listed" to reveal the internal workings of the
  92.         adventure.
  93.  
  94.         The adventure compiler is called ADVCOM and the interpreter is
  95.         called ADVINT.  These two programs in conjunction with this
  96.         documentation are all that is required to write and play
  97.         adventure games using this system.
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         ADVSYS            An Adventure Writing System             Page 3
  137.  
  138.  
  139.         RUNNING THE COMPILER
  140.  
  141.         If you have created an adventure definition file called
  142.         "MYADV.ADV", you can compile it with the command:
  143.  
  144.                 A>advcom myadv
  145.  
  146.         Typing this command will invoke the adventure compiler and cause
  147.         it to compile the file named "MYADV.ADV".  The ".ADV" extension
  148.         is added to the file name by the compiler.  During the process
  149.         of compiling the file, many messages will be printed telling
  150.         about the progress of the compiler.  At the end of the
  151.         compilation process, the compiler prints a set of statistics
  152.         describing the resulting data structure file.  This file will be
  153.         called "MYADV.DAT".  It contains the data structures needed by
  154.         the adventure interpreter to allow a player to play the
  155.         adventure game.
  156.  
  157.         Note: The "A>" in the line above is the MS-DOS prompt and should
  158.         not be typed as part of the command.
  159.  
  160.  
  161.         RUNNING THE INTERPRETER
  162.  
  163.         Assuming that you have a compiled adventure data file called
  164.         "MYADV.DAT", you can play the adventure by typing the command:
  165.  
  166.                 A>advint myadv
  167.  
  168.         This command will start the adventure.  There will probably be
  169.         some text printed at this point describing the adventure and the
  170.         initial situation.  You will then be prompted to type a command.
  171.         The prompt is the colon character.  The format for commands is
  172.         described under the section about the parser.  After typing a
  173.         command, you will be told what happened as a result of your
  174.         command, your new situation will be described and you will begin
  175.         the loop again.
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.         ADVSYS            An Adventure Writing System             Page 4
  203.  
  204.  
  205.         ADVENTURE DESCRIPTION FILE FORMAT
  206.  
  207.             All adventure description files contain a collection of
  208.             statements.  These statements must be formed according to
  209.             the following rules:
  210.  
  211.  
  212.         The adventure definition statement:
  213.  
  214.             All adventure definitions should have an ADVENTURE
  215.             statement.  This statement gives the name of the adventure
  216.             and the version number of the definition file.  Each
  217.             adventure should have a unique name.  This name is used to
  218.             identify "saved position" files and insure that only files
  219.             that correspond to the current adventure are restored.  The
  220.             version number allows the author to have many versions of
  221.             the same adventure during development and guarantee that
  222.             "save" files from one version aren't restored into another
  223.             version.
  224.  
  225.               (ADVENTURE name version)
  226.  
  227.           Example:
  228.  
  229.               (ADVENTURE sample 1)
  230.  
  231.  
  232.         Vocabulary statements:
  233.  
  234.             These statements add words to the adventure vocabulary.
  235.  
  236.               (ADJECTIVE word*)
  237.               (PREPOSITION word*)
  238.               (CONJUNCTION word*)
  239.               (ARTICLE word*)
  240.               (SYNONYM word synonym*)
  241.  
  242.           Examples:
  243.  
  244.               (ADJECTIVE red blue)
  245.               (CONJUNCTION and)
  246.               (SYNONYM big large)
  247.  
  248.           Note:
  249.  
  250.               Words are also added to the vocabulary by the object
  251.               and action definitions using the NOUN, ADJECTIVE, VERB
  252.               and PREPOSITION statements.
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         ADVSYS            An Adventure Writing System             Page 5
  269.  
  270.  
  271.         Constant definition statement:
  272.  
  273.               (DEFINE name value)
  274.  
  275.           Examples:
  276.  
  277.               (DEFINE what "I don't understand what you're saying!\n")
  278.               (DEFINE max-load 100)
  279.  
  280.  
  281.         Function definition statement:
  282.  
  283.               (DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)
  284.  
  285.           Example:
  286.  
  287.               (DEFINE (factorial n)
  288.                 (IF (< n 2)
  289.                   1
  290.                   (* n (factorial (- n 1)))))
  291.  
  292.  
  293.         Variable definition statement:
  294.  
  295.               (VARIABLE variable-name*)
  296.  
  297.           Example:
  298.  
  299.               (VARIABLE score i j)
  300.  
  301.  
  302.         Property name definition statement:
  303.  
  304.               (PROPERTY property-name*)
  305.  
  306.           Example:
  307.  
  308.               (PROPERTY weight value)
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         ADVSYS            An Adventure Writing System             Page 6
  335.  
  336.  
  337.         Comments:
  338.  
  339.             Comments begin with a semi-colon and end with the end of the
  340.             line.
  341.  
  342.           Example:
  343.  
  344.               ; this is a comment
  345.  
  346.  
  347.         Include files:
  348.  
  349.             Any line that begins with a "@" causes the inclusion of
  350.             another file.  The file name immediately follows the at-sign
  351.             and extends to the end of the line.  Only one level of
  352.             include is supported.
  353.  
  354.           Example:
  355.  
  356.               @basic.adv
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.         ADVSYS            An Adventure Writing System             Page 7
  401.  
  402.  
  403.         Handler definition statements:
  404.  
  405.               (INIT expr*)
  406.               (UPDATE expr*)
  407.               (BEFORE expr*)
  408.               (AFTER expr*)
  409.               (ERROR expr*)
  410.  
  411.           Example:
  412.  
  413.               (INIT
  414.                 (print "Welcome to the sample adventure!\n"))
  415.  
  416.  
  417.         Handlers:
  418.  
  419.             All activity within an adventure game is controlled by a
  420.             built-in handler loop.  Each of the handlers in the loop
  421.             contains code that is provided by the adventure author.  The
  422.             sequencing from handler to handler is provided by the
  423.             adventure system itself.
  424.  
  425.             The first handler that is called in an adventure game is the
  426.             INIT handler.  It prints some sort of introductory text and
  427.             initializes all global variables in order to start the
  428.             adventure game.
  429.  
  430.             After the INIT handler has completed, the normal loop is
  431.             entered.  It starts with the UPDATE handler.  The UPDATE
  432.             handler prepares for the player's next turn.  It should
  433.             describe the player's location if it has changed since the
  434.             last turn.  After the UPDATE handler completes, the parser
  435.             is called.  It prompts the player for a command, parses the
  436.             command, sets the built-in parser varaibles and exits.  Then
  437.             the BEFORE handler is called.  It is called before the
  438.             action associated with the command to allow the adventure
  439.             author to inspect the parser variables before proceeding to
  440.             the action itself.  After the BEFORE handler completes, the
  441.             action itself is called (or whatever action is stored in the
  442.             built-in variable $ACTION when the BEFORE handler
  443.             completes).  When the action completes, the AFTER handler is
  444.             called to give the author a chance to handle events that
  445.             happen only at the end of a successful turn.  The ERROR
  446.             handler is called when the parser detects an error.
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.         ADVSYS            An Adventure Writing System             Page 8
  467.  
  468.  
  469.         The handler loop:
  470.  
  471.             INIT
  472.              |
  473.              v
  474.             UPDATE<----------+
  475.              |               |
  476.              v               |
  477.             parse--->ERROR---+
  478.              |               |
  479.              v               |
  480.             BEFORE           |
  481.              |               |
  482.              v               |
  483.             action           |
  484.              |               |
  485.              v               |
  486.             AFTER------------+
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.         ADVSYS            An Adventure Writing System             Page 9
  533.  
  534.  
  535.         The parser:
  536.  
  537.             The parser handles all commands from the player.  It prompts
  538.             the player when it is ready for a new command.  The prompt
  539.             is the colon character.  When the player has typed a
  540.             command, the parser breaks the command into phrases.  The
  541.             parser recognizes the following command forms:
  542.  
  543.               [actor,] verb
  544.               [actor,] verb dobjects
  545.               [actor,] verb dobjects preposition iobject
  546.               [actor,] verb iobject dobjects
  547.  
  548.             Where:
  549.  
  550.               actor             ==> a noun phrase
  551.               verb              ==> the verb phrase (1 or 2 words)
  552.               dobjects          ==> dobject [conjunction dobject]*
  553.               dobject           ==> a noun phrase
  554.               preposition       ==> a preposition
  555.               iobject           ==> a noun phrase
  556.               noun phrase       ==> [article] [adjective]* noun
  557.  
  558.            Examples:
  559.  
  560.               Look
  561.               Take the red magic sword
  562.               Take the red sword and the blue bottle
  563.               Give the troll the red sword
  564.               Give the red sword to the troll
  565.               Troll, give me the sword
  566.  
  567.            Notes:
  568.  
  569.               Square brackets enclose optional phrases.  An asterisk
  570.               indicates zero or more of the preceeding element.
  571.  
  572.               The fourth form above is treated as if the player had
  573.               typed:
  574.  
  575.                 [actor,] verb dobject "to" iobject
  576.  
  577.             Once the parser has broken the command into phrases, it
  578.             assigns each noun phrase a number.  It stores the number of
  579.             the actor noun phrase in the built-in variable $ACTOR.  It
  580.             stores the first direct object noun phrase number in the
  581.             variable $DOBJECT.  It stores the number of direct objects
  582.             in the variable $NDOBJECTS.  It stores the indirect object
  583.             noun phrase number in the variable $IOBJECT.  If any of the
  584.             noun phrases is missing from the command, the corresponding
  585.             variable is set to NIL.  The parser saves the verb phrase
  586.             and preposition to use when determining which action to use
  587.             to handle the command.
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.         ADVSYS            An Adventure Writing System            Page 10
  599.  
  600.  
  601.         Action definition statement:
  602.  
  603.             Actions are used to handle player commands.  Each time the
  604.             parser finishes parsing a new command, it uses the verb
  605.             phrase and the preposition to locate an action to handle the
  606.             command.  Each action specifies a kind of template that must
  607.             match the command in order for the action to be called.  The
  608.             template consists of the words used in the verb phrase and
  609.             preposition and the existance of the actor, direct object
  610.             and indirect object noun phrases.  Once the parser finds an
  611.             action that matches the command, it stores the action in the
  612.             built-in variable $ACTION and exits.
  613.  
  614.               (ACTION action-name astat*)
  615.                   astat:
  616.                       (ACTOR [flag])
  617.                       (VERB verb*)
  618.                       (DIRECT-OBJECT [flag])
  619.                       (PREPOSITION word*)
  620.                       (INDIRECT-OBJECT [flag])
  621.                   flag:
  622.                       REQUIRED  must have the corresponding np
  623.                       OPTIONAL  may have the corresponding np
  624.                       FORBIDDEN must not have the corresponding np
  625.                   verb:
  626.                       word
  627.                       (word word)
  628.  
  629.           Example:
  630.  
  631.               (ACTION take
  632.                 (VERB take (pick up))
  633.                 (DIRECT-OBJECT)
  634.                 (CODE
  635.                   (print "You can't take the ")
  636.                   (print-noun $dobject)
  637.                   (print "!\n")))
  638.  
  639.             If the ACTOR, DIRECT-OBJECT or INDIRECT-OBJECT statements
  640.             are left out entirely, the settings of the corresponding
  641.             flags are taken from the action default definitions.  If
  642.             there is no action default definition, the value FORBIDDEN
  643.             is assumed.  If any of these statements is present, but no
  644.             flag is specified, it is treated as if the flag REQUIRED was
  645.             specified.
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         ADVSYS            An Adventure Writing System            Page 11
  665.  
  666.  
  667.         Action default definition statement:
  668.  
  669.             This statement defines default values for the ACTOR, DIRECT-
  670.             OBJECT and INDIRECT-OBJECT flags.
  671.  
  672.               (DEFAULT dstat*)
  673.                   dstat:
  674.                       (ACTOR [flag])
  675.                       (DIRECT-OBJECT [flag])
  676.                       (INDIRECT-OBJECT [flag])
  677.                   flag:
  678.                       REQUIRED
  679.                       OPTIONAL
  680.                       FORBIDDEN
  681.  
  682.           Example:
  683.  
  684.               (DEFAULT
  685.                 (ACTOR OPTIONAL))
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         ADVSYS            An Adventure Writing System            Page 12
  731.  
  732.  
  733.         Object definition statements:
  734.  
  735.             The object definition statements are used to define
  736.             individual objects and classes of objects.  The most basic
  737.             way of defining an object is using the (OBJECT ...)
  738.             statement.  This defines an object which has no parent
  739.             class.
  740.  
  741.             It is also possible to create a class of objects that share
  742.             information.  A class is defined just like a normal object.
  743.             It is given nouns, adjectives and properties.  In addition,
  744.             a class may have class properties.  These are properties
  745.             that are shared amongst all instances of the class.  In
  746.             order to create an instance of a class, the (class-name ...)
  747.             form is used.  This creates an instance of the named class.
  748.             An instance will inherit all nouns and adjectives from its
  749.             parent class.  It will also inherit all class properties
  750.             defined in the parent (and its parents).  Any normal
  751.             properties defined in the parent class will be copied to the
  752.             new object.  The copies will have the same values that the
  753.             parent has, but it is possible for the instance to have
  754.             property definitions that override these values.  Instances
  755.             may also have additional nouns, adjectives and properties.
  756.  
  757.               (OBJECT object-name ostat*)
  758.               (class-name object-name ostat*)
  759.                   ostat:
  760.                       (NOUN word*)
  761.                       (ADJECTIVE word*)
  762.                       (PROPERTY [property-name value]*)
  763.                       (CLASS-PROPERTY [property-name value]*)
  764.                   class-name:
  765.                       the name of a previously defined object
  766.  
  767.           Examples:
  768.  
  769.               (OBJECT sword
  770.                 (NOUN sword weapon)
  771.                 (CLASS-PROPERTY
  772.                   is-weapon T)
  773.                 (PROPERTY
  774.                   weight 10
  775.                   value 5
  776.                   damage 20))
  777.  
  778.               (sword red-sword
  779.                 (ADJECTIVE red)
  780.                 (PROPERTY
  781.                   damage 25))
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         ADVSYS            An Adventure Writing System            Page 13
  797.  
  798.  
  799.         Expressions:
  800.  
  801.               (+ expr expr)     add
  802.               (- expr expr)     subtract
  803.               (* expr expr)     multiply
  804.               (/ expr expr)     divide
  805.               (% expr expr)     remainder
  806.  
  807.               (& expr expr)     bit-wise and
  808.               (| expr expr)     bit-wise or
  809.               (~ expr)          bit-wise complement
  810.  
  811.             These arithmetic functions operate on integers.  As it turns
  812.             out, every data type in the system is represented by an
  813.             integer, so these functions will work with any type of
  814.             arguments.  They are probably only useful with integers,
  815.             however.
  816.  
  817.               (AND expr*)       logical and (short circuits)
  818.               (OR expr*)        logical or (short circuits)
  819.               (NOT expr)        logical not
  820.  
  821.             These functions operate on logical values.  In this system,
  822.             any value that is not equal to NIL (or zero) is considered
  823.             true.  NIL and zero are considered false.  AND and OR
  824.             evaluate their arguments from left to right and stop as soon
  825.             as the value of the entire expression can be determined.  In
  826.             other words, AND stops when it encounters a false value, OR
  827.             stops when it encounters a true value.
  828.  
  829.               (< expr expr)     less than
  830.               (= expr expr)     equal to
  831.               (> expr expr)     greater than
  832.  
  833.             These functions compare integers.  They cannot be used to
  834.             compare strings.
  835.  
  836.               (GETP obj property-name)          get the value of a property
  837.               (SETP obj property-name value)    set the value of a property
  838.  
  839.             These functions manipulate object properties.  They are used
  840.             to find the value of a property or to set the value of a
  841.             property.  They will also find and set the values of
  842.             inherited properties.  If GETP is used to find the value of
  843.             a property that doesn't exist for the specified object, NIL
  844.             is returned.  If SETP is used to set the value of a property
  845.             that doesn't exist, the operation is ignored.
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         ADVSYS            An Adventure Writing System            Page 14
  863.  
  864.  
  865.               (CLASS obj)
  866.  
  867.             This function returns the class of an object.  If the object
  868.             was defined with an (OBJECT ...) statement, NIL will be
  869.             returned.  If the object was defined with the (class-name
  870.             ...) statement, the class object will be returned.
  871.  
  872.               (MATCH obj noun-phrase-number)
  873.  
  874.             This function matches an object with a noun phrase.  An
  875.             object matches a noun phrase if it includes all of the
  876.             adjectives specified in the noun phrase and also includes
  877.             the noun mentioned.  Both nouns and adjectives can be
  878.             inherited.
  879.  
  880.               (YES-OR-NO)       get a yes or no answer from the player
  881.  
  882.             This function waits for the player to type a line.  If the
  883.             line begins with a 'Y' or a 'y', the function returns T.  If
  884.             the line begins with anything else, the function returns
  885.             NIL.
  886.  
  887.               (PRINT expr)                      print a string
  888.               (PRINT-NUMBER expr)               print a number
  889.               (PRINT-NOUN noun-phrase-number)   print a noun phrase
  890.               (TERPRI)                          terminate the print line
  891.  
  892.             These functions perform various sorts of output.  PRINT
  893.             prints strings, PRINT-NUMBER prints numbers and PRINT-NOUN
  894.             prints a noun phrase.
  895.  
  896.               (FINISH)          exit and continue with the AFTER handler
  897.               (CHAIN)           exit and continue with the next handler
  898.               (ABORT)           exit and continue with the UPDATE handler
  899.               (RESTART)         exit and restart the current game
  900.               (EXIT)            exit to the operating system
  901.  
  902.             These functions cause the immediate termination of the
  903.             current handler.  FINISH causes execution to proceed with
  904.             the AFTER handler, CHAIN causes execution to proceed with
  905.             the next handler in the normal sequence, ABORT causes
  906.             execution to proceed with the UPDATE handler (effectively
  907.             aborting the current turn), RESTART restores the game to its
  908.             original state and starts over with the INIT handler and
  909.             EXIT causes an immediate exit back to the operating system.
  910.  
  911.               (SAVE)            save the current game position
  912.               (RESTORE)         restore a saved game position
  913.  
  914.             These functions allow the player to save and restore
  915.             positions in the game.  They prompt the player for a file
  916.             name and either read a saved game position from the file or
  917.             write the current game position to the file.
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         ADVSYS            An Adventure Writing System            Page 15
  929.  
  930.  
  931.               (function-name expr*)
  932.  
  933.             This expression invokes a user defined function.  There
  934.             should be one expression for each of the formal arguments of
  935.             the user function.  The value of the expression is the value
  936.             of the last expression in the body of the user function or
  937.             the value passed to a RETURN statement within the function.
  938.  
  939.               (SETQ variable value)
  940.  
  941.             This expression sets the value of a user variable.
  942.  
  943.               (COND [(test expr*)]*)            execute conditionally
  944.               (IF test then-expr [else-expr])   traditional if-then-else
  945.               (WHILE test expr*)                conditional iteration
  946.               (PROGN expr*)                     block construct
  947.               (RETURN [expr])                   return from a function
  948.  
  949.             These statements are control constructs.
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         ADVSYS            An Adventure Writing System            Page 16
  995.  
  996.  
  997.         Primary expressions:
  998.  
  999.             integer             (digits preceeded by an optional sign)
  1000.             string              (characters enclosed in double quotes)
  1001.             action-name         (an action name)
  1002.             object-name         (an object or class name)
  1003.             property-name       (a property name)
  1004.             constant-name       (a defined constant or function)
  1005.             variable-name       (a variable name)
  1006.  
  1007.             Since an adventure description contains a large quantity of
  1008.             running text, the format for specifying string constants is
  1009.             somewhat extended from normal programming languages.  In
  1010.             this system, a string is enclosed in double quotes.  If the
  1011.             end of line occurs before the closing quote within a string,
  1012.             it is treated as if it were a space.  Any number of
  1013.             consecutive spaces is collapsed into a single space.  Also,
  1014.             the character pair "\n" is used to represent the "end of
  1015.             line" character, the pair "\t" is used to represent the tab
  1016.             character and the pair "\\" is used to represent the
  1017.             backslash character.
  1018.  
  1019.           Examples:
  1020.  
  1021.                 "This is a string.\n"
  1022.                 "This
  1023.                  is
  1024.                  a
  1025.                  string.\n"
  1026.  
  1027.             Both of the examples above represent the same string.
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.         ADVSYS            An Adventure Writing System            Page 17
  1061.  
  1062.  
  1063.         Definitions of symbols used above:
  1064.  
  1065.             expr                an expression
  1066.             value               an expression
  1067.             test                an expression (NIL means false, anything else is true)
  1068.             then-expr           an expression
  1069.             else-expr           an expression
  1070.             obj                 an expression that evaluates to an object
  1071.             property-name       an expression that evaluates to a property name
  1072.             noun-phrase-number  an expression that evaluates to a noun phrase number
  1073.             variable            a variable name
  1074.             T                   true
  1075.             NIL                 false
  1076.  
  1077.  
  1078.         Built-in variables set by the parser:
  1079.  
  1080.             $ACTOR              (actor noun phrase number)
  1081.             $ACTION             (action)
  1082.             $DOBJECT            (first direct object noun phrase number)
  1083.             $NDOBJECTS          (number of direct object noun phrases)
  1084.             $IOBJECT            (indirect object noun phrase number)
  1085.  
  1086.  
  1087.         Other built-in variables:
  1088.  
  1089.             $OCOUNT             (total number of objects in the system)
  1090.  
  1091.  
  1092.         CURRENT COMPILER LIMITS
  1093.  
  1094.             500         words
  1095.             500         objects
  1096.             20          properties per object
  1097.             200         actions or functions
  1098.             16384       bytes of code
  1099.             16384       bytes of data
  1100.             262144      bytes of text
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.